package logic

import (
	"2211a_mayi/service/cache"
	"context"

	"2211a_mayi/service/internal/svc"
	"2211a_mayi/service/mayi"

	"github.com/zeromicro/go-zero/core/logx"
)

type CartListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewCartListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CartListLogic {
	return &CartListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *CartListLogic) CartList(in *mayi.CartListRequest) (*mayi.CartListResponse, error) {
	cartList := cache.CartList(int(in.UserId))

	return &mayi.CartListResponse{
		Item: cartList,
	}, nil
}
